package org.ljx.taobao.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * @Author: Ljx
 * @Date: 2021/12/31 12:05
 * @role: 监听器
 */
@WebListener
public class InitLoginCountListener implements ServletContextListener {
    /**
     * 默认用户数量0
     * @param sce ServletContextEvent
     */
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        sce.getServletContext().setAttribute("onlineCount",0);
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}

